Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actually tell why file read fails #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lkotipal
Copy link
Contributor

@lkotipal lkotipal commented Dec 4, 2023

No description provided.

Copy link
Contributor

@ykempf ykempf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While at it I suppose also the other MPI_* calls like closing could be improved?

parallelFileOpen = true;
} else {
success = false;
cerr << "Failed to open parallel file with MPI error " << error << endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this now a number, or some string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an int. I suppose the proper way would be to have a function mapping error codes to descriptions of MPI errors but now it at least doesn't just gobble up the error code and spit out the non-answer of "there was an error".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that tracks, just needs a whopper to convert that from C-string to something sensible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't that be plonked to cerr? Or to a stringstreamstream and then that gets cerr'ed?

Copy link
Contributor Author

@lkotipal lkotipal Dec 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at the function signature, the actual string "returned" is an argument. So the conversion is sth like:

char c[MPI_MAX_ERROR_STRING];
int len;
MPI_Error_string(err, c, &len);
std::string s (s, len);

else parallelFileOpen = true;

if (success == false) cerr << "Failed to open parallel file" << endl;
int err {MPI_File_open(comm,const_cast<char*>(fileName.c_str()),accessMode,mpiInfo,&filePtr)};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"While valid, this is stupid." :) Initializers do have their uses but let's be realistic, here it's just odd. (TBH is odd also on line 420 since it's just a single variable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants